﻿#pragma once

#include "Ability/EditorAbilityViewModel.h"
#include "EditorObjectPropertyAbilityModel.h"
#include "Math/Math.h"
#include "Scene/SceneNode.h"
#include "EditorObjectPropertyAbilityViewModel.m.h"

class RSceneNode;
class REditorPropertyViewModel;

RCLASS()
class REditorObjectPropertyAbilityViewModel : public REditorAbilityViewModel
{
    ROBJECT

public:
    void BindModel(TSharedObjectPtr<REditorAbilityModel> InModel) override;
    virtual TSharedObjectPtr<RTexture2D> GetIcon() const override;
    virtual TSharedObjectPtr<RTexture2D> GetHighlightIcon() const override;

protected:
    TWeakObjectPtr<REditorObjectPropertyAbilityModel> PropertyModel;
    TSharedObjectPtr<RTexture2D> Icon;
    TSharedObjectPtr<RTexture2D> HighlightIcon;

    // TSharedObjectPtr<RTexture2D> CheckedIcon;
    // TSharedObjectPtr<RTexture2D> HighlightCheckedIcon;
    // TSharedObjectPtr<RTexture2D> UncheckedIcon;
    // TSharedObjectPtr<RTexture2D> HighlightUncheckedIcon;
public:
    TDelegate<void> OnPropertyListChanged;

    bool HasObject() const;
    int64_t GetPropertiesNum() const;
    TSharedObjectPtr<REditorPropertyViewModel> GetProperty(int64_t InIndex) const;

    float SpliterLeftOffset = 100.f;

    void AddComponent(TSubclassOf<RSceneNodeComponent> InComponentClass);
    void RemoveComponent(TSharedObjectPtr<RSceneNodeComponent> InComponent);
protected:
    
    void UpdateProperties();

    TVector<TSharedObjectPtr<REditorPropertyViewModel>> Properties;

};